//
//  BusinessCardChangeBgCell.m
//  Btpin
//
//  Created by Vic on 2019/12/21.
//  Copyright © 2019 Vic. All rights reserved.
//

#import "BusinessCardChangeBgCell.h"

@interface BusinessCardChangeBgCell ()
{
    UIImageView *bgImgView;
    UILabel *lbl;
    UIImageView *selectImgView;
}
@end

@implementation BusinessCardChangeBgCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initUI];
    }
    return self;
}
- (void)initUI {
    bgImgView = [UIToolsControl initImageViewWithFrame:CGRectMake(ScalePS(10), ScalePS(10), WIDTH-ScalePS(20), ScalePS(238)) imageName:nil];
    bgImgView.userInteractionEnabled = NO;
    bgImgView.layer.cornerRadius = ScalePS(8);
    bgImgView.layer.masksToBounds = YES;
    [self.contentView addSubview:bgImgView];
    
    lbl = [UIToolsControl initLabelWithFrame:CGRectMake(ViewWidth(bgImgView)-ScalePS(143), ScalePS(200), ScalePS(100), ScalePS(28)) text:nil textColor:COLOR_OF_WHITE font:Font_15];
    lbl.textAlignment = NSTextAlignmentRight;
    [bgImgView addSubview:lbl];
    
    selectImgView = [UIToolsControl initImageViewWithFrame:CGRectMake(ViewWidth(bgImgView)-ScalePS(38), ScalePS(200), ScalePS(28), ScalePS(28)) imageName:@"privacysetting_main_n"];
    selectImgView.userInteractionEnabled = NO;
    [bgImgView addSubview:selectImgView];
}
- (void)reloadDataForModel:(BusinessCardChangeBgModel *)model {
    [bgImgView sd_setImageWithURL:[NSURL URLWithString:model.image]];
    lbl.text = model.name;
    selectImgView.image = [UIImage imageNamed:model.isSelect?@"privacysetting_main_s":@"privacysetting_main_n"];
}

- (void)awakeFromNib {
    [super awakeFromNib];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
